<script type="text/javascript">
    $(function() {
        $("#datepicker1").datepicker();
        $.datepicker.setDefaults($.datepicker.regional['vi']);
    });
    $(function() {
        $("#datepicker2").datepicker();
        $.datepicker.setDefaults($.datepicker.regional['vi']);
    });
    function ObjOnFocus(field,strMess,IsPass) {
        if(field.value==strMess) {
            field.value = '';
            field.style.fontStyle='normal';
            field.style.color = 'black';
            if(IsPass)
                field.type="password";
        }
    }
    function ObjOnBlur(field,strMess,IsPass) {
        if(field.value=='')
        {
            field.style.fontStyle='italic';
            field.style.color = 'Gray';
            field.value= strMess;
            if(IsPass)
                field.type="text";
        }
    }

</script>


<form name="frmAddProduct" id="frmAddProduct" method="post" action="" enctype="multipart/form-data" class="">
    <table cellpadding="0" cellspacing="0" width="100%" class="table-form-post round_border">
        <col width="25%">
        <col width="75%">
        <tbody>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td colspan="2">
                    <p style="float:left;width:350px;text-align:center;">
                        <label for="auto" class="cpointer"><input type=radio id="auto" value="1" name="typer" onclick="return Mudim.SetMethod(4);" checked="checked"><span class=AVIMControl>Tự động</span></label>
                        <label for="telext" class="cpointer"><input type=radio id="telext" value="1" name="typer" onclick="return Mudim.SetMethod(2);"><span class=AVIMControl>TELEX</span></label>
                        <label for="vni" class="cpointer"><input type=radio id="vni" value="1" name="typer" onclick="return Mudim.SetMethod(1);"><span class=AVIMControl>VNI</span></label>
                        <label for="off" class="cpointer"><input type=radio id="off" value="1" name="typer" onclick="return Mudim.SetMethod(0);"><span class=AVIMControl>Tắt</span></label>
                    </p>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Tên sản phẩm
                </td>
                <td>
                    <input type="text" name="product_title" id="product_title" class="w300p" tooltipText="Nhập tên sản phẩm."><span id="product_title_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Hình ảnh sản phẩm
                </td>
                <td>
                    <input type="file" name="mainImage[]" id="product_main_image" size="42">
                    <span id="product_image_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Danh mục sản phẩm
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <div class="list-item-category">
                        <div id="cat_for_add_1">
                            <select class="w160p" id="selectcatforadd1" size="12" onclick="AdminController.checkExistProductSubCategory('product', this.value, 1);AdminController.selectProductMakerOnClick(this.value);AdminController.selectProductSpecs(this.value);"></select>
                        </div>
                        <div id="cat_for_add_2" class="hide">
                            <select class="w160p" id="selectcatforadd2" size="12" onclick="AdminController.checkExistProductSubCategory('product', this.value, 2);AdminController.selectProductMakerOnClick(this.value);AdminController.selectProductSpecs(this.value);">

                            </select>
                        </div>
                        <div id="cat_for_add_3" class="hide">
                            <select class="w160p" id="selectcatforadd3" size="12" onclick="AdminController.checkExistProductSubCategory('product', this.value, 3);AdminController.selectProductMakerOnClick(this.value);AdminController.selectProductSpecs(this.value);">

                            </select>
                        </div>
                        <div id="cat_for_add_4" class="hide">
                            <select class="w160p" id="selectcatforadd4" size="12" onclick="AdminController.checkExistProductSubCategory('product', this.value, 4);AdminController.selectProductMakerOnClick(this.value);AdminController.selectProductSpecs(this.value);">

                            </select>
                        </div>
                        <div id="cat_for_add_5" class="hide">
                            <select class="w160p" id="selectcatforadd5" size="12" onclick="AdminController.checkExistProductSubCategory('product', this.value, 5);AdminController.selectProductMakerOnClick(this.value);AdminController.selectProductSpecs(this.value);">

                            </select>
                        </div>
                    </div>
                    <span id="product_category_id_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Hãng sản xuất
                </td>
                <td>
                    <select name="product_maker_id" id="product_maker_id" class="w200p">
                        <option value="">Chọn hãng sản xuất</option>
                    </select>
                    <span id="product_maker_id_error" class="validate_error" style="display: none;"></span>
                    <input type="hidden" id="list-product-maker-hide" name="list-product-maker-hide">
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Giá USD
                </td>
                <td>
                    <input type="text" name="product_price_usd" id="product_price_usd" class="w110p" onchange="AdminController.changeUsdToVnd();" onkeyup="AdminController.formatCurrency('change_price_usd', 'product_price_usd');">
                    <div id="change_price_usd"></div>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Giá bán (VNĐ)
                </td>
                <td>
                    <input type="text" name="product_price_vnd" id="product_price_vnd" class="w110p" onkeyup="AdminController.formatCurrency('change_price_1', 'product_price_vnd');" onchange="AdminController.formatCurrency('change_price_1', 'product_price_vnd');AdminController.changeVndToUsd();"><label for="product_is_vat" class="cpointer">Đã có VAT<input type="checkbox" id="product_is_vat" name="product_is_vat" value="1"></label><span id="product_price_vnd_error" class="validate_error" style="display: none;"></span>
                    <div id="change_price_1"></div>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Giá khuyến mãi (VNĐ)
                </td>
                <td>
                    <input type="text" name="product_price_vnd_km" id="product_price_vnd_km" class="w110p" onkeyup="AdminController.formatCurrency('change_price_2', 'product_price_vnd_km');"><label for="product_price_active_km" class="cpointer">Hiện giá KM<input type="checkbox" id="product_price_active_km" name="product_price_active_km" value="1"></label><span id="product_price_vnd_km_error" class="validate_error" style="display: none;"></span>
                    <div id="change_price_2"></div>
                </td>
            </tr>
            
            <tr>
                <td class="td-form-title">
                    Phân loại sản phẩm
                </td>
                <td>
                    <select name="product_type_id" id="product_type_id" class="w200p">
                        <option value="">Chọn loại sản phẩm</option>
                        <?php foreach ($aryProductType as $key => $value) {
 ?>
                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
                    </select>
                    <span id="product_type_id_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Tình trạng trong kho
                </td>
                <td>
                    <select name="product_store_id" id="product_store_id" class="w200p">
                        <option value="">Chọn tình trạng</option>
<?php foreach ($aryProductStore as $key => $value) { ?>
                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
                    </select>
                    <span id="product_store_id_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Thời gian bảo hành
                </td>
                <td>
                    <select name="product_warranty_id" id="product_warranty_id" class="w200p">
                        <option value="">Chọn thời gian bảo hành</option>
<?php foreach ($aryProductWarranty as $key => $value) { ?>
                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
                    </select>
                    <span id="product_warranty_id_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Xuất sứ
                </td>
                <td>

                    <select name="product_origin_id" id="product_origin_id" class="w200p">
                        <option value="">Chọn xuất sứ</option>
<?php foreach ($aryProductOrigin as $key => $value) { ?>
                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
                    </select>
                    <span id="product_origin_id_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
                <tr>
                <td class="td-form-title">
                    Bộ hàng chuẩn
                </td>
                <td>
                    <input type="text" id="product_full_box" name="product_full_box" class="w300p">
                </td>
            </tr>
            <tr>
                <td class="td-form-title">
                    Hình thức vận chuyển
                </td>
                <td>
                    <select id="product_transportation_id" name="product_transportation_id" style="width:318px">
                        <option value="">Chọn hình thức vận chuyển</option>
<?php foreach ($aryProductTrans as $key => $value) { ?>
                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
                    </select>
                    <span id="product_transportation_id_error" class="validate_error" style="display: none;"></span>
                </td>
            </tr>
            <tr>
                <td >
                    <div class="item-cat-header">Thông tin khuyến mại</div>
                </td>
                <td>
                    <div>

                        <span>Từ ngày<input type="text" class="autotextbox" onfocus="ObjOnFocus(this,'Chọn ngày',false)" onblur="ObjOnBlur(this,'Chọn ngày',false)" style="width: 80px;" id="datepicker1" name="product_promotional_from"></span>
                        <span>Đến ngày<input class="autotextbox" onfocus="ObjOnFocus(this,'Chọn ngày',false)" onblur="ObjOnBlur(this,'Chọn ngày',false)" style="width: 80px;" id="datepicker2" name="product_promotional_to"></span>
                        <span id="product_promotional_error" class="validate_error" style="display: none;"></span>
                    </div>

                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <textarea class="product_promotional" id="product_promotional" name="product_promotional"></textarea>
                </td>
            </tr>


            <tr>
                <td colspan="2" class="item-cat-header">
                    Các thông số cơ bản của sản phẩm
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <textarea class="product_highlight" id="product_highlight" name="product_highlight"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div id="product_highlight_error" class="validate_error" style="display: none;"></div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div id="product_specs"></div>
                </td>
            </tr>
            <tr style="height: 10px;"></tr>
            <tr>
                <td rowspan="2" valign="bottom">
                    <div class="item-cat-header">Bài viết mô tả về sản phẩm</div>
                </td>
                <td align="right">
                    <div id="fileQueue" class="area-input-image"></div>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <input type="file" name="uploadify" id="uploadify" />
                    <a href="javascript:$('#uploadify').uploadifyUpload();"><img src="/public/images/form/upload.png" border="0" /></a>
                    <a href="javascript:jQuery('#uploadify').uploadifyClearQueue()"><img src="/public/images/form/huybo.png" border="0"/></a>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <textarea name="product_content" id="product_content" rows="10" cols="40" class="tinymce"></textarea>
                </td>

            </tr>
            <tr>
                <td colspan="2" align="center">
                    <div class="input_field no_margin_bottom">
                        <input type="hidden" name="product_id" id="product_id" value="">
                        <input type="hidden" name="product_category_id_hidden" id="product_category_id_hidden" value="">
                        <input type="hidden" name="product_cat_info_is_change" id="product_cat_info_is_change" value="">
                        <input type="button" name="submitMemberPost" id="submitMemberPost" class="cpointer submit">
                        <input type="button" name="cancelEditor" id="cancelEditor" class="cpointer submit" value="Hủy bỏ" onclick="AdminController.hideProductEditor();" >
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
</form>
